import Vue from 'vue'
import router from '@/router'
import store from '@/store'

Vue.prototype.$ke_router = new class {
  push (map) {
    router.push({
      name: map.name,
      query: {
        m: store.getters['router/current'].query.m,
        ...map.query,
      },
      params: map.params
    })
  }

  replace (map) {
    router.replace({
      name: map.name,
      query: {
        m: store.getters['router/current'].query.m,
        ...map.query,
      },
      params: map.params
    })
  }
}
